package com.authine.cloudpivot.ext.applicationservice;

import com.authine.cloudpivot.ext.model.bosi.BsscResp;
import com.authine.cloudpivot.ext.model.bosi.OrderAcceptModel;
import com.authine.cloudpivot.ext.model.bosi.OrderGoodsDeliverModel;
import com.authine.cloudpivot.ext.model.goods.GoodsModel;
import com.authine.cloudpivot.ext.service.BsscService;
import com.authine.cloudpivot.ext.service.impl.BsscServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import java.util.List;

import static com.authine.hermes.app.launcher.service.ApplicationServiceFoundation.CUSTOM_SERVICE;

/**
 * @Author hxd
 * @Date 2021/10/11 20:22
 * @Description 调用冀中接口
 **/

@Path("PunchoutBosiApi")
@Slf4j
public class PunchoutBosiApi {


    private BsscService bsscService = BsscServiceImpl.getInstance();

    @Path("goodsImport")
    @POST
    @Operation(summary = "冀中:商品导入", tags = CUSTOM_SERVICE, description = "")
    public BsscResp goodsImport(@RequestBody List<GoodsModel> goodsModelList) {
        return bsscService.goodsImport(goodsModelList);
    }

    @Path("updateGoodsAmount")
    @POST
    @Operation(summary = "冀中:商品导入", tags = CUSTOM_SERVICE, description = "")
    public BsscResp updateGoodsAmount(@RequestBody GoodsModel goodsModel) {
        return bsscService.updateGoodsAmount(goodsModel);
    }

    @Path("updateGoodsInventory")
    @POST
    @Operation(summary = "冀中:商品库存变更", tags = CUSTOM_SERVICE, description = "")
    public BsscResp updateGoodsInventory(@RequestBody GoodsModel goodsModel) {
        return bsscService.updateGoodsInventory(goodsModel);
    }

    @Path("updateGoodsStatus")
    @POST
    @Operation(summary = "冀中:商品上下架状态变更", tags = CUSTOM_SERVICE, description = "")
    public BsscResp updateGoodsStatus(@RequestBody List<GoodsModel> goodsModel) {
        return bsscService.updateGoodsStatus(goodsModel);
    }

    @Path("updateGoodsImages")
    @POST
    @Operation(summary = "冀中:商品图片变更", tags = CUSTOM_SERVICE, description = "")
    public BsscResp updateGoodsImages(@RequestBody GoodsModel goodsModel) {
        return bsscService.updateGoodsImages(goodsModel);
    }

    @Path("updateGoodsSpec")
    @POST
    @Operation(summary = "冀中:商品规格变更", tags = CUSTOM_SERVICE, description = "")
    public BsscResp updateGoodsSpec(@RequestBody GoodsModel goodsModel) {
        return bsscService.updateGoodsSpec(goodsModel);
    }

    @Path("updateGoodsDetail")
    @POST
    @Operation(summary = "冀中:商品详情变更", tags = CUSTOM_SERVICE, description = "")
    public BsscResp updateGoodsDetail(@RequestBody GoodsModel goodsModel) {
        return bsscService.updateGoodsDetail(goodsModel);
    }

    /**********************************************订单****************************************************/

    /**
     * 冀中商品接单
     * @param orderAcceptModel
     * @return
     */
    @Path("orderAccept")
    @POST
    @Operation(summary = "冀中商品接单", tags = CUSTOM_SERVICE, description = "")
    public List<BsscResp> orderAccept(@RequestBody List<OrderAcceptModel> orderAcceptModel) {
        return bsscService.orderAccept(orderAcceptModel);
    }

    /**
     * 冀中商品发货
     * @param orderGoodsDeliverModel
     * @return
     */
    @Path("orderGoodsDeliver")
    @POST
    @Operation(summary = "冀中商品发货", tags = CUSTOM_SERVICE, description = "")
    public BsscResp orderGoodsDeliver(@RequestBody OrderGoodsDeliverModel orderGoodsDeliverModel) {
        return bsscService.orderGoodsDeliver(orderGoodsDeliverModel);
    }

}
